package yixaun.tim.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import yixaun.tim.service.TimService;
import yixaun.tim.service.impl.TimServiceImpl;

/**
 * @author pengshiqing
 * @Date: 2019/6/22
 * @Description:
 */
@Configuration
@EnableConfigurationProperties(TimProperties.class)
@ConditionalOnClass(TimService.class)
public class TimAutoConfiguration {

    @Autowired
    private TimProperties timProperties ;

    @Bean
    @ConditionalOnMissingBean(TimService.class)
    public TimService getTIMService(){
        return new TimServiceImpl(timProperties) ;
    }
}
